﻿@model Magicodes.WeiChat.Data.Models.Site.Site_Menu

@{
    ViewBag.Title = "新建";
}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <hr style="margin: 2px 2px 10px 2px;" />

                    @using (Html.BeginForm())
                    {
                        @Html.AntiForgeryToken()

                        <div class="form-horizontal">
                            @Html.ValidationSummary(true, "", new { @class = "text-danger" })

                            <div class="form-group">
                                @Html.LabelFor(model => model.ParentId, new { @class = "control-label col-sm-2" })
                                <div class="col-sm-10">
                                    @Html.DropDownList("ParentId", ViewBag.ParentId as SelectList, "根菜单", new { @class = "form-control" })
                                    <span class="help-block m-b-none">为空则表示根菜单。</span>
                                    @Html.ValidationMessageFor(model => model.ParentId, "", new { @class = "text-danger" })
                                </div>
                            </div>

                            <div class="form-group">
                                @Html.LabelFor(model => model.Title, new { @class = "control-label col-sm-2" })
                                <div class="col-sm-10">
                                    @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
                                    @*<span class="help-block m-b-none">辅助性描述文字。</span>*@
                                    @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" })
                                </div>
                            </div>

                            <div class="form-group">
                                @Html.LabelFor(model => model.Url, new { @class = "control-label col-sm-2" })
                                <div class="col-sm-10">
                                    @Html.EditorFor(model => model.Url, new { htmlAttributes = new { @class = "form-control" } })
                                    @*<span class="help-block m-b-none">辅助性描述文字。</span>*@
                                    @Html.ValidationMessageFor(model => model.Url, "", new { @class = "text-danger" })
                                </div>
                            </div>

                            <div class="form-group">
                                @Html.LabelFor(model => model.Controller, new { @class = "control-label col-sm-2" })
                                <div class="col-sm-10">
                                    @Html.EditorFor(model => model.Controller, new { htmlAttributes = new { @class = "form-control" } })
                                    @*<span class="help-block m-b-none">辅助性描述文字。</span>*@
                                    @Html.ValidationMessageFor(model => model.Controller, "", new { @class = "text-danger" })
                                </div>
                            </div>

                            <div class="form-group">
                                @Html.LabelFor(model => model.Action, new { @class = "control-label col-sm-2" })
                                <div class="col-sm-10">
                                    @Html.EditorFor(model => model.Action, new { htmlAttributes = new { @class = "form-control" } })
                                    @*<span class="help-block m-b-none">辅助性描述文字。</span>*@
                                    @Html.ValidationMessageFor(model => model.Action, "", new { @class = "text-danger" })
                                </div>
                            </div>

                            <div class="form-group">
                                @Html.LabelFor(model => model.IconCls, new { @class = "control-label col-sm-2" })
                                <div class="col-sm-10">
                                    @*@Html.EditorFor(model => model.Coordinates, new { htmlAttributes = new { @class = "form-control" } })*@
                                    <div class="input-group">
                                        <input class="form-control" name="IconCls" readonly="readonly" placeholder="请点击右侧按钮选择图标" type="text" value="">
                                        <span class="input-group-btn">
                                            <a class="btn btn-primary" id="btnGetIconCls"><i class="fa fa-binoculars"></i>&nbsp;</a>
                                        </span>
                                    </div>
                                    @Html.ValidationMessageFor(model => model.IconCls, "", new { @class = "text-danger" })
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-md-offset-2 col-sm-10">
                                    <button type="submit" class="btn btn-primary"><i class="fa fa-save"></i>&nbsp;提交</button>
                                    <a href="@Url.Action("Index")" class="btn btn-primary"><i class="fa fa-mail-reply"></i>&nbsp;返回</a>
                                </div>
                            </div>
                        </div>
                    }
                </div>
            </div>
        </div>
    </div>
</div>
@section Styles {
    @*请自行移除没用到的样式*@
    @*复选框样式*@
    @Styles.Render("~/Content/plugins/iCheck/iCheckStyles")
    @*日期控件样式*@
    @Styles.Render("~/plugins/dataPickerStyles")
}
@section Scripts
{
    <script>
        $(function() {
            $('#btnGetIconCls')
                .on('click',
                    function() {
                        mwc.window.show('选择图标', '@Url.RouteUrl("GetIconsRoute")');
                    });
        });

        function setIcon(cls) {
            $('input[name=IconCls]').val(cls);
            $('#btnGetIconCls').html('<i class="' + cls + '"></i>&nbsp;');
        }
    </script>
}